package org.example.myleet.p1678;

public class Solution {
    public String interpret(String command) {
//        return command.replace("()", "o").replace("(al)", "al");
        StringBuilder result = new StringBuilder();
        char[] commandCharArr = command.toCharArray();
        for (int i = 0; i < command.length(); ++i) {
            char c = commandCharArr[i];
            if (c == 'G') {
                result.append(c);
            } else if (c == '(') {
                if (commandCharArr[i + 1] == 'a') {
                    result.append('a').append('l');
                    i += 3;
                } else {
                    result.append('o');
                    ++i;
                }
            }
        }
        return result.toString();
    }
}
